package com.bolt.core.view.tag;

import com.bolt.core.view.config.ConfigUtils;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyTagSupport;

/**
 * Created by Administrator on 2017/9/15.
 */
public class InputAttributeTag extends BodyTagSupport {

    private String value;



    public InputTag getParentTag() {
        return ((InputTag) this.getParent());
    }

    protected void evaluateExpressions()throws JspException {
        String string = null;
        if ((string = EvalHelper.evalString("value", getId(), this, pageContext)) != null) {
            setValue(string);
        }
    }


    protected void populateAttribute(){
        InputTag tag = getParentTag();
        ConfigUtils.parserConfigText(tag.getComponent(),this.value);
    }


    @Override
    public int doStartTag() throws JspException {
        evaluateExpressions();
        populateAttribute();
        return SKIP_BODY;
    }


    @Override
    public int doEndTag() throws JspException {
        return EVAL_PAGE;
    }




    public void setValue(String value) {
        this.value = value;
    }
}
